package com.day0923.shopping.data;


import com.day0921.Man_machine_guessing.Game;

public class Date {
    /* 商品信息 */
    private Goods[] goods = null;
    /* 会员信息 */
    private Customer[] customers = null;
    /* 管理员 */
    private Manager[] managers = null;

    public Date() {
        managers = new Manager[3];
        goods = new Goods[3];
        customers = new Customer[3];
        init();
    }

    public void init(){
        Manager manager1 = new Manager("admin","0000");
        managers[0] = manager1;
        Manager manager2 = new Manager("admin1","1111");
        managers[1] = manager1;
        Manager manager3 = new Manager("admin2","2222");
        managers[2] = manager1;
        Customer customer1 = new Customer(1000,"09/10",20);
        Customer customer2 = new Customer(1001,"09/11",30);
        Customer customer3 = new Customer(1002,"09/12",40);
        customers[0] = customer1;
        customers[1] = customer2;
        customers[2] = customer3;
        Goods goods1 = new Goods("旺旺雪饼",5);
        Goods goods2 = new Goods("旺旺碎冰冰",8);
        Goods goods3 = new Goods("青岛啤酒",10);
        goods[0] = goods1;
        goods[1] = goods2;
        goods[2] = goods3;
    }

    public Manager login(String username,String userpwd){
        for (Manager manager : managers){
            if (manager.getUsername().equals(username)){
                if (manager.getUserpwd().equals(userpwd)){
                    return manager;
                }
            }
        }
        return null;
    }

    public Goods[] getGoods() {
        return goods;
    }

    public void setGoods(Goods[] goods) {
        this.goods = goods;
    }

    public Customer[] getCustomers() {
        return customers;
    }

    public void setCustomers(Customer[] customers) {
        this.customers = customers;
    }

    public Manager[] getManagers() {
        return managers;
    }

    public void setManagers(Manager[] managers) {
        this.managers = managers;
    }
}
